﻿using GrainManage.Entities.Contact;
using GrainManage.Server.Business;
using System.Web.Mvc;

namespace GrainManage.Server.Controllers
{
    public class ContactController : BaseController
    {
        private readonly ContactBusiness business = new ContactBusiness();

        //************************************************POST************************************************

        [HttpPost]
        public ActionResult SearchName(InputSearchName input)
        {
            var result = business.SearchName(input);
            return NewtonsoftJson(result);
        }

        [HttpPost]
        public ActionResult SearchArea(InputSearchArea input)
        {
            var result = business.SearchArea(input);
            return NewtonsoftJson(result);
        }

        [HttpPost]
        public ActionResult SearchAddress(InputSearchAddress input)
        {
            var result = business.SearchAddress(input);
            return NewtonsoftJson(result);
        }

        [HttpPost]
        public ActionResult GetByID(InputGetByID input)
        {
            var result = business.GetByID(input);
            return NewtonsoftJson(result);
        }

        [HttpPost]
        public ActionResult Search(InputSearch input)
        {
            var result = business.Search(input);
            return NewtonsoftJson(result);
        }

        [HttpPost]
        public ActionResult Insert(InputInsert input)
        {
            var result = business.Insert(input);
            return NewtonsoftJson(result);
        }

        [HttpPost]
        public ActionResult Update(InputUpdate input)
        {
            var result = business.Update(input);
            return NewtonsoftJson(result);
        }

        [HttpPost]
        public ActionResult Delete(InputDelete input)
        {
            var result = business.Delete(input);
            return NewtonsoftJson(result);
        }

        [HttpPost]
        public ActionResult BatchInsert(InputBatchInsert input)
        {
            var result = business.BatchInsert(input);
            return NewtonsoftJson(result);
        }

        [HttpPost]
        public ActionResult BatchUpdate(InputBatchUpdate input)
        {
            var result = business.BatchUpdate(input);
            return NewtonsoftJson(result);
        }

        [HttpPost]
        public ActionResult BatchDelete(InputBatchDelete input)
        {
            var result = business.BatchDelete(input);
            return NewtonsoftJson(result);
        }
    }
}
